﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using DataTier.Repository;
using BusinessLogic.Entities;
using BusinessLogic.Helpers;

namespace BusinessLogic.ServiceClients
{
    public class ProductClient
    {


        public ProductClient()
        {
        }


        /// <summary>
        /// Возвращается список продуктов, входящих в категорию с Id = groupId
        /// </summary>
        /// <param name="groupId"></param>
        /// <returns></returns>
        public IQueryable<ProductEntity> ProductsByCategory(int? groupId = null)
        {
            var products = new ProductRepository().ProductsByCategory(groupId);
            return products.Select(p => EntityHelper.GetProductEntity(p));
        }


    }
}